package com.fx.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * des:
 *  配置类，目前是配置跨域问题
 * @author fxiao
 * @date 2020/10/29 12:00
 */
@Configuration
public class CrosConfig implements WebMvcConfigurer {
    @RequestMapping()
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowedOrigins("*")
                .allowedMethods("GET","HEAD","POST","PUT","DELETE","OPTIONS")
                .allowCredentials(true)
                .allowedHeaders("*");
    }
}
